package com.example.a22310.myapplication.Beans;

import android.databinding.BaseObservable;
import android.databinding.Bindable;
import android.databinding.BindingAdapter;
import android.widget.ImageView;

import com.squareup.picasso.Picasso;

import java.io.Serializable;
import java.util.List;

import static com.example.a22310.myapplication.GloableClass.Yuejian.IMG_URL;

public class PostDetail {


    private int code;
    private List<PostlistBean> postlist;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public List<PostlistBean> getPostlist() {
        return postlist;
    }

    public void setPostlist(List<PostlistBean> postlist) {
        this.postlist = postlist;
    }

    public static class PostlistBean extends BaseObservable implements Serializable {
        /**
         * id : 1
         * pic_id : 1
         * pic : 02.jpg
         */

        private String id;
        private String pic_id;
        private String pic;





        public PostlistBean() {
        }

        public PostlistBean(String pic) {
            this.pic = pic;
        }
        @BindingAdapter("pic")
        public static void loadInternetImage(ImageView iv, String pic) {
            pic = IMG_URL+pic;
            Picasso.with(iv.getContext()).load(pic).into(iv);
        }


        @Override
        public String toString() {
            return "PostlistBean{" +
                    "pic='" + pic + '\'' +
                    '}';
        }


        @Bindable

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getPic_id() {
            return pic_id;
        }

        public void setPic_id(String pic_id) {
            this.pic_id = pic_id;
        }

        public String getPic() {
            return IMG_URL+pic;
        }

        public void setPic(String pic) {
            this.pic = pic;
        }
    }
}
